# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=nuspell
pkgver=3.1.2
pkgrel=0
pkgdesc="Free and open source C++ spell checking library"
url="https://nuspell.github.io/"
arch="all"
license="LGPL-3.0-or-later"
depends_dev="boost-dev"
makedepends="$depends_dev cmake icu-dev ronn catch2"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/nuspell/nuspell/archive/v$pkgver/nuspell-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		$CMAKE_CROSSOPTS .
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="ed5206cb9ffa7e4ec6843988a75627d4ae7d5170444b6e7bd3496c1bf61c25412c4e68864800f2ad238d014b4e50d25282f367de2900f8a230f3ecc9ae5772be  nuspell-3.1.2.tar.gz"
